package org.test.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.test.dao.ShoppingCartMapper;
import org.test.service.ShoppingCartService;
import org.test.vo.ShoppingCart;

import java.util.List;

@Service
public class ShoppingCartServiceImpl implements ShoppingCartService {
    //注入DAO层
    @Autowired
    ShoppingCartMapper shoppingCartMapper;

    @Override
    public int addBookToShoppingCart(int id, int bookid, String bookname, int booknum) {
        return shoppingCartMapper.addBookToShoppingCart(id,bookid,bookname,booknum);
    }

    @Override
    public ShoppingCart selectShoppingByBook(int id, int bookid) {
        return shoppingCartMapper.selectShoppingByBook(id,bookid);
    }

    @Override
    public int addBooknumToShoppingCart(int cartid,int booknum) {
        return shoppingCartMapper.addBooknumToShoppingCart(cartid,booknum);
    }

    @Override
    public List<ShoppingCart> selectShoppingCartAll(int id) {
        return shoppingCartMapper.selectShoppingCartAll(id);
    }

   /* @Override
    public ShoppingCart selectShoppingCartAllBook(int id) {
        return shoppingCartMapper.selectShoppingCartAllBook(id);
    }*/

    @Override
    public void deleteShoppingCart(int cartid) {
        shoppingCartMapper.deleteShoppingCart(cartid);
    }
}
